When applying function
you have option to apply three different type of function:
§
Axis
function
§
Hierarchy
function
§
Element
function
All three types are the
same MDX function, but difference is in place where you apply
them.
Since MDX functions can be applied on several places
inside axis, in CubePlayer we recognize three types of functions:
·
Axis functions
·
Dimension functions
·
Element functions (inner functions)
Axis functions
Axis functions are always applied to entire axis
regardless of number of dimension-hierarchies at that axis.
Example
We have level
We
will apply TopCount 100 on entire axis
SELECT
NON EMPTY
TopCount
(
{
[Customer].[hCountry].[State Province].MEMBERS
}
,100, [Measures].[Store
Sales]
)
ON AXIS(0)
FROM
[Sales]
Now when we add another dimension/hierarch, let us
say Product Family it will come inside function or better to say
function will be applied
after CrossJoin:
SELECT
NON EMPTY
TopCount
(
CrossJoin
(
{
[Customer].[hCountry].[State Province].MEMBERS
},
{
[Product].[hProduct].[Product Family].MEMBERS
}
)
,100, [Measures].[Store
Sales]
)
ON AXIS(0)
FROM
[Sales]
The same will be when we add third
dimension:
SELECT
NON EMPTY
TopCount
(
CrossJoin
(
CrossJoin
(
{
[Customer].[hCountry].[State Province].MEMBERS
},
{
[Product].[hProduct].[Product Family].MEMBERS
}
),
{
[Store].[hStoreType].[Store Type].MEMBERS
}
)
,100, [Measures].[Store
Sales]
)
ON AXIS(0)
FROM
[Sales]
Dimension
functions
Dimension functions will always be applied around
one dimension/hierarchy.
Example
We have level
We
will apply TopCount 100 on entire axis
SELECT
NON EMPTY
TopCount
(
{
[Customer].[hCountry].[State Province].MEMBERS
}
,100, [Measures].[Store
Sales]
)
ON AXIS(0)
FROM
[Sales]
At this point Axis function and Dimension function
are the same since they are applied on only one dimension.
Let us add another dimension/hierarchy Product
Family
SELECT
NON EMPTY
CrossJoin
(
TopCount
(
{
[Customer].[hCountry].[State Province].MEMBERS
},
100,
[Measures].[Store Sales]
),
{
[Product].[hProduct].[Product Family].MEMBERS
}
)
ON AXIS(0)
FROM
[Sales]
As you can see TopCount is
now inside CrossJoin applied only on dimension
Customer.
Let us add another member or level from dimension
Customer. In our case Member
SELECT
NON EMPTY
CrossJoin
(
TopCount
(
{
[Customer].[hCountry].[State Province].MEMBERS ,
[Customer].[hCountry].[Country].&[USA]
},
100,
[Measures].[Store Sales]
),
{
[Product].[hProduct].[Product Family].MEMBERS
}
)
ON AXIS(0)
FROM
[Sales]
Since TopCount is applied
to dimension Customer, member from dimension Customer
is placed inside TopCount function, therefore TopCount function will have influence to
that member as
well.
Element functions
Element functions will always be applied to single
element.
Example
We have level
We
will apply TopCount 100 on entire axis
SELECT
NON EMPTY
TopCount
(
{
[Customer].[hCountry].[State Province].MEMBERS
}
,100, [Measures].[Store
Sales]
)
ON AXIS(0)
FROM
[Sales]
At this point Axis function, Dimension functions and
element functions are the same since they are
applied on only one
dimension.
Let us add another element from another
dimension/hierarchy
SELECT
NON EMPTY
CrossJoin
(
{
TopCount
(
{
[Customer].[hCountry].[State Province].MEMBERS
}
,100, [Measures].[Store
Sales]
)
},
{
[Product].[hProduct].[Product Family].MEMBERS
}
)
ON AXIS(0)
FROM
[Sales]
At this point Dimension functions and Element
functions are the same since they are
only one element from each
dimension.
Now we will make difference. We will add another
element from Customer dimension,
SELECT
NON EMPTY
CrossJoin
(
{
TopCount
(
{
[Customer].[hCountry].[State Province].MEMBERS
}
,100, [Measures].[Store Sales]
),
[Customer].[hCountry].[Country].&[USA]
},
{
[Product].[hProduct].[Product Family].MEMBERS
}
)
ON AXIS(0)
FROM
[Sales]
As you can see Element function remains applied on
element from beginning, other words on only
one element.
More: